/**
 * @ClassName StringDemo01
 * @Description 使用new String()时，new产生的字符串对象是位于堆中
 * @Author Li
 * @Date 2022/8/1 8:49
 * @ModifyDate 2022/8/1 8:49
 * @Version 1.0
 */
public class StringDemo01 {
    public static void main(String[] args) {
        String str1 = "hello";
        String str2 = "hello";
        String str3  = new String("hello");
        String str4  = new String("hello");
        System.out.println(str1 == str2); // true
        System.out.println(str1 == str3); // false
        System.out.println(str3 == str4); // false
        System.out.println(str1.equals(str2)); // true
        System.out.println(str1.equals(str3)); // true
        System.out.println(str3.equals(str4)); // true
    }
}
